<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserLoginRecordsTable extends Migration
{

    protected $tableName = 'user_login_records';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create($this->tableName, function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id');
            $table->string('scope', 512)->comment('');
            $table->string('name');
            $table->string('mobile');
            $table->string('ip', 256)->comment('IP地址');
            $table->string('user_agent', 256)->comment('客户端');

            $table->timestamps();
            $table->softDeletes();

        });
        DB::statement("ALTER TABLE `$this->tableName` comment '管理员登录记录表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->tableName);
    }
}
